package com.card.utils;

import java.util.Date;
import java.util.Random;
import java.util.Vector;

import com.card.game.Card;
import com.xiaoao.net.utils.TimeUtils;

/**   
 * @Description: TODO(用一句话描述该文件做什么) 
 * @author siyunlong  
 * @date 2016年8月15日 上午9:50:42 
 * @version V1.0   
 */
public class Utils {
	public static int randomSieve() {
		Random random = new Random();
		return random.nextInt(6)+1;
	}
	
	// 0:南  1:东  2:北 3:西
	public static int getFirstIndex(int seed) {
		int v = seed % 4;
		if(v == 0) return 1;
		if(v == 3) return 0;
		if(v == 2) return 3;
		if(v == 1) return 2;
		return 0;
	}
	// 0:南  1:东  2:北 3:西
	public static int getTggIndex(int seed) {
		int v = seed % 4;
		if(v == 0) return 3;
		if(v == 3) return 2;
		if(v == 2) return 1;
		if(v == 1) return 0;
		return 0;
	}
	
	public static Vector<Card> parseCards(String str) {
		Vector<Card> cards = new Vector<>();
		try {
			String[] cc = str.split(";");
			for (String string : cc) {
				String[] ss = string.split("_");
				int type = Integer.parseInt(ss[0]);
				int index = Integer.parseInt(ss[1]);
				cards.add(new Card(type, index));
			}
		} catch (Exception e) {
		}
		return cards;
	}
	public static void main(String[] args) {
		Date date = new Date(1502185633660L);
		System.err.println(TimeUtils.ToString(date));
	}
}
